|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectga.core.algorithm.automatic.SGAGeneration<T>
T
- The generic type of individuals.public class SGAGeneration<T extends IIndividual<T>>
Generational simple genetic algorithm.
Field Summary | |
---|---|
private static int |
CRITICAL_WHILE_ITERATIONS
|
private ICrossoverOp<T> |
crossoverOp
|
private GAContext |
gaContext
|
private int |
generation
|
private static java.util.logging.Logger |
LOGGER
|
private IMutationOp<T> |
mutateOp
|
private IPopulation<T> |
population
|
private ISelector<T> |
selector
|
private boolean |
useEliteStrategy
|
private boolean |
validate
|
private IValidator<T> |
validator
|
Fields inherited from interface ga.core.GA |
---|
KEY_EVALUATED_INDIVIDUALS_MIN_COUNT, KEY_GENOME_MAX_LENGTH, KEY_GENOME_MIN_LENGTH, KEY_INIT_INDIVIDUAL, KEY_INIT_INDIVIDUAL_PERCENTAGE, KEY_INTERVAL_FITNESS_MAX_WIDTH, KEY_VALIDATION_SPACE |
Constructor Summary | |
---|---|
SGAGeneration(IPopulation<T> population,
IFitnessEvaluator<T> evaluator,
ISelector<T> selector,
IMutationOp<T> mutateOperator,
ICrossoverOp<T> crossoverOperator,
boolean useEliteStrategy)
Creates a new generational SGA. |
|
SGAGeneration(IPopulation<T> population,
IFitnessEvaluator<T> evaluator,
ISelector<T> selector,
IMutationOp<T> mutateOperator,
ICrossoverOp<T> crossoverOperator,
boolean useEliteStrategy,
GAContext context)
Creates a new generational SGA. |
Method Summary | |
---|---|
private IndividualList<T> |
doReproduction()
Selects two individuals, recombines and mutates them. |
IPopulation<T> |
getPopulation()
Getter for the population. |
void |
init()
Initializes the algorithm and population. |
void |
setValidate(boolean validate)
Setter to enable/disable individual validation. |
void |
setValidator(IValidator<T> validator)
Set the individual validator for the algorithm. |
void |
step()
Do one step. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.util.logging.Logger LOGGER
private static final int CRITICAL_WHILE_ITERATIONS
private final IPopulation<T extends IIndividual<T>> population
private final ISelector<T extends IIndividual<T>> selector
private final IMutationOp<T extends IIndividual<T>> mutateOp
private final ICrossoverOp<T extends IIndividual<T>> crossoverOp
private IValidator<T extends IIndividual<T>> validator
private final GAContext gaContext
private boolean validate
private boolean useEliteStrategy
private int generation
Constructor Detail |
---|
public SGAGeneration(IPopulation<T> population, IFitnessEvaluator<T> evaluator, ISelector<T> selector, IMutationOp<T> mutateOperator, ICrossoverOp<T> crossoverOperator, boolean useEliteStrategy, GAContext context)
population
- Population for the GA.evaluator
- The automatic evaluator.selector
- The selector.mutateOperator
- The mutation operator.crossoverOperator
- The crossover operator.useEliteStrategy
- Use elite strategy or not.context
- The ga context.public SGAGeneration(IPopulation<T> population, IFitnessEvaluator<T> evaluator, ISelector<T> selector, IMutationOp<T> mutateOperator, ICrossoverOp<T> crossoverOperator, boolean useEliteStrategy)
population
- Population for the GA.evaluator
- The automatic evaluator.selector
- The selector.mutateOperator
- The mutation operator.crossoverOperator
- The crossover operator.useEliteStrategy
- Use elite strategy or not.Method Detail |
---|
public void init()
GA
init
in interface GA<T extends IIndividual<T>>
public void step()
GA
step
in interface GA<T extends IIndividual<T>>
private IndividualList<T> doReproduction()
public void setValidate(boolean validate)
GA
true
and a validator must be set.
setValidate
in interface GA<T extends IIndividual<T>>
validate
- Enable/disable validation.public void setValidator(IValidator<T> validator)
GA
null
and validate must have been activated.
setValidator
in interface GA<T extends IIndividual<T>>
validator
- The individual validator.public IPopulation<T> getPopulation()
GA
getPopulation
in interface GA<T extends IIndividual<T>>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |